<script setup>
import config from "@/config";
// import { useStore } from "vuex";
// const store = useStore();
const url = config.vue2;
const mounted = () => {
  const loading = document.querySelector("#appLoading");
  setTimeout(() => {
    loading.style.display = "none";
  }, 1000);
  console.log(loading, "在基座监听子应用loading");
};
const unmount = () => {
  console.log("在基座监听子应用unmount卸载");
};
const afterhidden = () => {
  //类比vue中deactivated
  console.log("在基座监听子应用afterhidden推入后台出发");
};
const beforeshow = () => {
  //类比vue中actived
  console.log("在基座监听子应用beforeshow推入前台之前出发");
};
const aftershow = () => {
  //类比vue中actived
  console.log("在基座监听子应用aftershow推入前台之后出发");
};
const handleDatachange = (e) => {
  let { activeIndex } = e.detail.data;
  console.log(activeIndex, "基座监听子应用datachange");
  localStorage.setItem("activeIndex", activeIndex);
  // store.commit("setActiveIndex", activeIndex);
};
</script>

<template>
  <div>
    <div id="appLoading">找工作子应用.......</div>

    <micro-app
      @datachange="handleDatachange"
      keep-alive
      name="childJob"
      :url="url"
      baseroute="/main/childJob"
      @mounted="mounted"
      @unmount="unmount"
      @afterhidden="afterhidden"
      @beforeshow="beforeshow"
      @aftershow="aftershow"
    ></micro-app>
  </div>
</template>

<style></style>